package org.ncibi.cytoscape.metscape.multidisplay.gui.model;

public class AnimationModel {

	private double score = 0.0;
	private double part = 0.0;
	private double animationPosition = 0.0;
	
	public void updatePositionInformation(double s, double p) {
		score = s;
		part = p;
	}

	public double getScore(){
		return score;
	}
	
	public double getPart(){
		return part;
	}
	
	public double getAnimationPostion(){
		return animationPosition;
	}
	
	public void setAnimationPosition(double value) {
		if (value < 0.0) value = 0.0;
		if (value > 1.0) value = 1.0;
		animationPosition = value;
	}
	
	public void incrementAnimationPosition(double frac){
		if (frac > 1.0) frac = 1.0;
		if (frac < -1.0) frac = -1.0;
		if (frac == 0.0) return;
		
		double probe = animationPosition + frac;
		if ((probe >= 0.0) && (probe <= 1.0)) 
			setAnimationPosition(probe);
		else if (probe < 0.0) // wrap at low end
			setAnimationPosition(1.0);
		else //(probe > 1.0) - wrap at high end
			setAnimationPosition(0.0);
	}
}
